const axios = require('axios');

async function testRecognition() {
  try {
    // 登录获取token
    const loginResponse = await axios.post('http://localhost:10003/user-service/auth/login', {
      username: 'admin',
      password: '123456'
    });
    
    console.log('Login response:', loginResponse.data);
    
    const token = loginResponse.data.data;
    console.log('Token:', token);
    
    // 触发文献识别
    const recognitionResponse = await axios.post(
      'http://localhost:10003/document-service/literature/4/recognize',
      {},
      {
        headers: {
          'Authorization': `Bearer ${token}`,
          'Content-Type': 'application/json'
        }
      }
    );
    
    console.log('Recognition response:', recognitionResponse.data);
  } catch (error) {
    console.error('Error:', error.response ? error.response.data : error.message);
  }
}

testRecognition();